package studychinese.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.hschinese.pronunciation.R;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;


/**
 * Created by lenovo on 2017/4/9.
 */
public class HopeRankAdapter extends AppAdapter {
    private int mPosstion = -1;

    public HopeRankAdapter(List list, Context context) {
        super(list, context);


    }

    /*  */
    @Override
    public View createView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            convertView = View.inflate(context, R.layout.item_gv_homerank, null);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);

        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }


        if(position==0){

            viewHolder.ivItemHoperank.setImageResource(R.mipmap.columnar_0_unclick);
            viewHolder.tv_item_hoperank_number.setText("1级");
        }else if(position==1){
            viewHolder.ivItemHoperank.setImageResource(R.mipmap.columnar_1_unclick);
            viewHolder.tv_item_hoperank_number.setText("2级");
        }else if(position==2){
            viewHolder.ivItemHoperank.setImageResource(R.mipmap.columnar_2_unclick);
            viewHolder.tv_item_hoperank_number.setText("3级");
        }else if(position==3){
            viewHolder.ivItemHoperank.setImageResource(R.mipmap.columnar_3_unclick);
            viewHolder.tv_item_hoperank_number.setText("4级");
        }else if(position==4){
            viewHolder.ivItemHoperank.setImageResource(R.mipmap.columnar_4_unclick);
            viewHolder.tv_item_hoperank_number.setText("5级");
        }else if(position==5){
            viewHolder.ivItemHoperank.setImageResource(R.mipmap.columnar_5_unclick);
            viewHolder.tv_item_hoperank_number.setText("6级");
        }else if(position==6){
            viewHolder.ivItemHoperank.setImageResource(R.mipmap.columnar_6_unclick);
        }



        return convertView;
    }


     class ViewHolder {
        @Bind(R.id.iv_item_hoperank)
        ImageView ivItemHoperank;
        @Bind(R.id.tv_item_hoperank_number)
        TextView tv_item_hoperank_number;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }

    }
}
